package com.brave.service.controller;


import com.brave.base.BaseController;
import com.brave.base.CheckNullParamKit;
import com.brave.base.RedisKit;
import com.brave.service.dto.PublishServiceDTO;
import com.brave.user.dto.RedisUserInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@Api(value = "服务模块", tags = "服务模块", description = "服务模块")
@RestController
@RequestMapping("/v1/service")
public class ServiceUpdateController extends BaseController
{
    @Autowired
    private RedisKit redisKit;
    
    
    
    
    
    @ApiOperation(value = "发布服务")
    @ApiImplicitParam(name = "dto", value = "查询参数", required = true, dataType = "PublishServiceDTO")
    @PostMapping(value = "/publishService", produces = "application/json")
    public String publishService(@RequestHeader String token, @RequestBody PublishServiceDTO dto)
    {
        RedisUserInfo redisUserInfo = redisKit.checkUserToken(token);
        if(null == redisUserInfo)
        {
            return tokenBadRequest();
        }
        //参数校验
        Map<String, String> checkMap = CheckNullParamKit.checkParam(dto);
        if(0 != checkMap.size())
        {
            return badParameter(checkMap);
        }
        //调用业务逻辑
        return success();
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
}